package org.halk.job_admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * 线程池配置，用于 定时任务
 *
 * @Author haozhu7
 * @Date 2024/9/21 10:32
 **/
@Configuration
public class TaskSchedulerPoolConfig {

    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        // 设置线程池大小
        scheduler.setPoolSize(30);
        scheduler.setThreadNamePrefix("bi-job");
        scheduler.initialize();
        return scheduler;
    }
}